package com.ease.integration.jms.core;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;

public class JmsAccesser {

	private JmsTemplate jmsSenderTemplate;

	public void sendText(final String text) {
		jmsSenderTemplate.send(new MessageCreator() {
			public Message createMessage(Session session) throws JMSException {
				TextMessage textMessage = session.createTextMessage();
				textMessage.setText(text);
				return textMessage;
			}
		});
	}

	/**
	 * @return Returns the jmsSenderTemplate.
	 */
	public JmsTemplate getJmsSenderTemplate() {
		return jmsSenderTemplate;
	}

	/**
	 * @param jmsSenderTemplate
	 *            The jmsSenderTemplate to set.
	 */
	public void setJmsSenderTemplate(JmsTemplate jmsSenderTemplate) {
		this.jmsSenderTemplate = jmsSenderTemplate;
	}

}
